<template>
  <div class="cs-p">
    <el-form
      :inline="true"
      size="small">

      <el-form-item >
        <el-button
          v-if="isAuth('normaliza:normalizadicttype:save')"
          icon="el-icon-plus"
          :disabled="loading"
          @click="handleCreate">新增</el-button>
      </el-form-item>
    </el-form>
    <cs-table :table-data="currentTableData"
              :table-label="tableLabel"
              :isSelection="isSelection"
              @handleButton="handleButton"
              :table-option="tableOption">
    </cs-table>
  </div>
</template>

<script>
export default {
  props: {
    currentTableData: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      loading: false,
      isSelection: false,
      tableLabel: [
        { label: '字典名称', param: 'name', align: 'center', sortable: false, isShow: true },
        { label: '字典码', param: 'code', align: 'center', isShow: true },
        { label: '创建时间', param: 'createTime', align: 'center', sortable: false, isShow: true },
        { label: '修改时间', param: 'updateTime', align: 'center', sortable: false, slot: true, isShow: true }
      ],
      tableOption: {
        label: '操作',
        width: '200',
        options: [
          { label: '编辑', type: 'primary', icon: 'el-icon-edit', methods: 'audit', auth: 'normaliza:normalizadicttype:update' },
          { label: '删除', type: 'danger', icon: 'el-icon-delete', methods: 'delete', auth: 'normaliza:normalizadicttype:delete' }
        ]
      }
    }
  },
  components: {
    'CsTable': () => import('@/components/cs-table')
  },
  methods: {
    handleCreate() {},
    handleButton(val) {
      this.$emit('handleButton', val)
    }
  }
}
</script>

<style>
  .el-table .warning-row {
    background: oldlace;
  }

  .el-table .spacer-row {
    background: #FAFAFA;
  }
</style>
